<template>
  <!-- <van-nav-bar title="小杨记事本（手绘板）" /> -->
  <div class="index_box bgcolor handdrawn-style">
    <div class="bgcolor none_box"></div>
    <div class="index_container">
      <div class="calendar_box handdrawn-border">
        <van-calendar
          title="日历"
          :poppable="false"
          :min-date="minDate"
          :show-confirm="false"
          :style="{ height: '300px' }"
        />
      </div>
      <div class="note_detail">
        <el-timeline style="max-width: 600px">
          <el-timeline-item
            timestamp="2018/4/12"
            placement="top"
            v-for="item in listData"
            @click="choseCard(item)"
          >
            <el-card shadow="always">
              <div class="flex">
                <div class="card_left">
                  <h4 class="text_over">{{ item.note_title }}</h4>
                  <p class="text_over">{{ item.note_content }}</p>
                </div>
                <div class="card_right">
                  <p>{{ item.time }}</p>
                  <p>{{ item.mood }}</p>
                </div>
              </div>
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';

const minDate = ref(new Date('2024-01-01'));
// 模拟日记内容
const listData = ref([
  {
    note_title: '标题',
    note_content: '日记内容1dskjdhskjfhdskjhfdksjhfdskjh',
    time: '2024.8.27',
    mood: '开心',
  },
  {
    note_title: '标题',
    note_content: '日记内容',
    time: '2024.8.27',
    mood: '开心',
  },
  {
    note_title: '标题',
    note_content: '日记内容',
    time: '2024.8.27',
    mood: '开心',
  },
  {
    note_title: '标题',
    note_content: '日记内容',
    time: '2024.8.27',
    mood: '开心',
  },
]);

const choseCard = item => {
  console.log(item, '~~~~~~~~~~');
};
</script>

<style class="less" scoped>
@import url('../handdrawn.css');
@import url('../doodle.css');

.index_box {
  height: 100vh;
  .index_container {
    width: 85%;
    height: 90vh;
    overflow: scroll;
    background-color: white;
    margin: auto;
    margin-top: 10px;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
  }
}
.bgcolor {
  background-color: #eae9e9;
}
.none_box {
  height: 1px;
}
.van-calendar__body {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  color: black;
  background-color: #fff8e1;
  border: 2px solid black;
  border-radius: 8px;
}

.van-calendar__day {
  border: 1px solid black;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s;
}

.van-calendar__day--selected {
  background-color: #ffd54f;
  border: 2px solid black;
  transform: scale(1.1);
}
/* 全局 CSS 文件 */
.handdrawn-style * {
  font-family: 'Architects Daughter', cursive;
  /* 添加其他手绘样式 */
}
.flex {
  display: flex;
  justify-content: space-between;
}
.card_left {
  width: 75%;
}
.text_over {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
</style>
